home *** CD-ROM | disk | FTP | other *** search
/ Light ROM Gold / Light ROM Gold.iso / arexx / m_points.lwm < prev    next >
Text File  |  1982-05-16  |  2KB  |  92 lines

  1. /* CMD: Scale_On_Center
  2.  * Scale Object by it's center */
  3. /* Nir Hermoni, zapa@datasrv.co.il
  4. */
  5.  
  6. libadd = addlib("LWModelerARexx.port",0)
  7. signal on error
  8. signal on syntax
  9.  
  10. Points_Num=XFRM_BEGIN()
  11.  
  12. if points_num ~=2 then call notify(1,'Sorry, EXACTLY 2 points in layer')
  13.  
  14. if points_num ~=2 then exit
  15.  
  16. do i = 1 to 2
  17.  
  18.  pos.i = XFRM_GETPOS(i)
  19.     
  20. /*  call notify(1,'vector 'i' = 'pos.i) */
  21.  
  22.             x.i = subword(pos.i,1,1)
  23.             y.i = subword(pos.i,2,1)
  24.             z.i = subword(pos.i,3,1)
  25.  
  26.     end i
  27.  
  28. call XFRM_END()
  29. call req_begin "Middle points, (C) Nir Hermoni 1995"
  30.  
  31. PID = req_addcontrol("Num of points","N",0)
  32.  
  33. call req_setval PID,1
  34.  
  35. if (~req_post()) then do
  36.     call req_end
  37.     exit
  38. end
  39.  
  40. Mid_Points = req_getval(PID)
  41.  
  42. call req_end()
  43.  
  44. dist_x =x.1-x.2
  45. /*  call notify(1,'dist_x = 'dist_x) */
  46. dist_y =y.1-y.2
  47. /*  call notify(1,'dist_y = 'dist_y) */
  48. dist_z =z.1-z.2
  49. /*  call notify(1,'dist_z = 'dist_z) */
  50.  
  51. /*
  52. low_x = x.1        
  53. if x.1 > x.2 then low_x = x.2
  54.  
  55.  
  56. low_y = y.1
  57. if y.1 > y.2 then low_y = y.2
  58.  
  59.  
  60. low_z = z.1
  61. if z.1 > z.2 then low_z = z.2
  62. */
  63.  
  64. next_x = dist_x/(mid_points+1)
  65. /*  call notify(1,'points delta x = 'next_x) */
  66.  
  67. next_y = dist_y/(mid_points+1)
  68. /*  call notify(1,'points delta y = 'next_y) */
  69.  
  70. next_z = dist_z/(mid_points+1)
  71. /*  call notify(1,'points delta z = 'next_z) */
  72.  
  73. call ADD_BEGIN()
  74.  
  75. do i = 1 to mid_points
  76.     
  77.     call ADD_POINT(x.2+i*next_x' 'y.2+i*next_y' 'z.2+i*next_z)
  78.  
  79.     end i
  80.  
  81. call ADD_END()
  82.  
  83.     
  84. if (libadd) then call remlib("LWModelerARexx.port")
  85. exit
  86.  
  87. syntax:
  88. error:
  89.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  90.   if (libadd) then call remlib("LWModelerARexx.port")
  91.     exit
  92.